package storage

import (
	"web_framework/model"
	"github.com/jmoiron/sqlx"
)

const (
	RedisJoinDeviceInfoKey        = ":joinDevices:Info"    //连接路由器的设备详情
	RedisJoinDeviceOnlineListKey  = ":joinDevices:online"  //在线设备集合
	RedisJoinDeviceOfflineListKey = ":joinDevices:offline" //离线设备集合

	JoinDevicesOnline  = 1 //连接设备在线状态
	JoinDevicesOffline = 2 //连接设备离线状态
)

//查询连接设备类型
func GetDeviceType(db sqlx.Queryer, mac string) (model.MobileType, error) {
	var res model.MobileType
	err := sqlx.Get(db, &res, "select * from st_mobile_type where mac = ?", mac)
	if err != nil {
		return res, err
	}
	return res, nil
}
